#region Assembly System.ComponentModel.DataAnnotations.dll, v4.0.30319
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.ComponentModel.DataAnnotations.dll
#endregion

using System;
using System.Collections.Generic;
using System.Linq;

namespace System.ComponentModel.DataAnnotations
{
    /// Summary:
    ///     Represents a container for the results of a validation request.
    public class ValidationResult
    {
        /// <summary>
        /// Returns NULL
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
        public static readonly ValidationResult Success;

        readonly IEnumerable<string> m_MemberNames;

        /// <summary>
        ///     Initializes a new instance of the System.ComponentModel.DataAnnotations.ValidationResult
        ///     class by using a System.ComponentModel.DataAnnotations.ValidationResult object.
        /// </summary>
        public ValidationResult(string errorMessage, IEnumerable<string> memberNames)
        {
            ErrorMessage = errorMessage;
            m_MemberNames = memberNames ?? new string[0];
        }

        /// <summary>
        /// Summary:
        ///     Initializes a new instance of the System.ComponentModel.DataAnnotations.ValidationResult
        ///     class by using an error message.
        ///
        /// Parameters:
        ///   errorMessage:
        ///     The error message.
        /// </summary>
        public ValidationResult(string errorMessage)
        {
            ErrorMessage = errorMessage;
            m_MemberNames = new string[0];
        }

        /// <summary>
        /// Summary:
        ///     Gets the error message for the validation.
        ///
        /// Returns:
        ///     The error message for the validation.
        /// </summary>
        public string ErrorMessage { get; set; }

        /// <summary>       
        /// Summary:
        ///     Gets the collection of member names that indicate which fields have validation
        ///     errors.
        ///
        /// Returns:
        ///     The collection of member names that indicate which fields have validation
        ///     errors.
        /// </summary>
        public IEnumerable<string> MemberNames { get { return m_MemberNames; } }

    }
}
